Support for -EAGAIN from xc_gnttab_map_grant_ref.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Dec 2009 06:27:56 +0000 (06:27 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Dec 2009 06:27:56 +0000 (06:27 +0000)
Signed-off-by: Grzegorz Milos <Grzegorz.Milos@citrix.com>
tools/libxc/xc_linux.c

index de176fbb8b08fa105c764459b0c8d4439148f8b5..0f1b78aa571678bda3e2809b7b8ee2dc0138f74b 100644 (file)
@@ -442,13 +442,19 @@ void *xc_gnttab_map_grant_ref(int xcg_handle, uint32_t domid, uint32_t ref,
     if ( ioctl(xcg_handle, IOCTL_GNTDEV_MAP_GRANT_REF, &map) )
         return NULL;
 
+mmap_again:    
     addr = mmap(NULL, PAGE_SIZE, prot, MAP_SHARED, xcg_handle, map.index);
     if ( addr == MAP_FAILED )
     {
         int saved_errno = errno;
         struct ioctl_gntdev_unmap_grant_ref unmap_grant;
 
-        /* Unmap the driver slots used to store the grant information. */
+        if(saved_errno == EAGAIN)
+        {
+            usleep(1000);
+            goto mmap_again;
+        }
+         /* Unmap the driver slots used to store the grant information. */
         perror("xc_gnttab_map_grant_ref: mmap failed");
         unmap_grant.index = map.index;
         unmap_grant.count = 1;